home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-23 | 76.7 KB | 1,085 lines |
- MEMBER('DEMO.clw') ! This is a MEMBER module
- MAP
- BrowseIntermediate:Update:BrowseQueue2(LONG,LONG,<LONG>,<BYTE>,<BYTE>)
- END
-
-
-
-
- BrowseIntermediate PROCEDURE
-
- !--------------------------------------------------------------------------------------------------!
- ! Declarations !
- !--------------------------------------------------------------------------------------------------!
- LocalRequest LONG,AUTO
- LocalResponse LONG,AUTO
- WindowOpened LONG
- Search STRING(40)
- ChangeOrder STRING(1)
- MarkStatus STRING(15)
- Search2 STRING(20)
- OriginalRequest LONG,AUTO
- WindowInitialized LONG
- ForceRefresh LONG,AUTO
- WinWidth LONG(359) ! Save Window Width for Resizing
- WinHeight LONG(178) ! Save Window Height for Resizing
- CurrentSelected LONG,AUTO ! Save Current Selected Field
-
- FORMAT:BrowseQueue1:Default EQUATE('60L(1)|_~MarkStatus~@s15@85L(1)|_~Name~@S20@20L(1)|_~Code~@S5@')
-
- SQ1:SortOrder BYTE !Current Sort Order for the List Box
- DropBoxOrderQ QUEUE,PRE(SQ1) !Queue Use to Store Sort Order Info
- OrderName STRING(60) ! Description shown in drop box
- SearchPicture STRING(30) ! Picture Clause for Search Field
- OrderFormat STRING(500) ! Format String for the List Box
- END !End Queue Declaration
-
- FORMAT:BrowseQueue2:Default EQUATE('')
- FORMAT:BrowseQueue2:Order1 EQUATE('60L(1)|_~Ingredient~@S15@32L(1)|_~Measure~@S8@20L(1)|_~Qty~@S5@')
- FORMAT:BrowseQueue2:Order2 EQUATE('32L(1)|_~Measure~@S8@#2#20L(1)|_~Qty~@S5@60L(1)|_~Ingredient~@S15@#1#')
-
- SQ7:SortOrder BYTE !Current Sort Order for the List Box
- OptBoxOrderQ:BrowseQueue2 QUEUE,PRE(SQ7) !Queue Use to Store Sort Order Info
- OrderName STRING(60) ! Description shown in drop box
- SearchPicture STRING(30) ! Picture Clause for Search Field
- OrderFormat STRING(500) ! Format String for the List Box
- END !End Queue Declaration
-
- MarkAllFlag BYTE !Flag Indicating All Records Marked
- MarkQueue QUEUE,PRE(MQ1) !Queue Used to Store Marked Records
- RecipeNo LIKE(RCP:RecipeNo),NAME('TC_MarkKey') ! Unique Record Id for the File
- END !End Queue Declaration
-
-
- BrowseQueue1 QUEUE !Queue Used by List when Browsing Records
- MarkStatus LIKE(MarkStatus) ! Queue Display Field
- RCP:Name LIKE(RCP:Name) ! Queue Display Field
- RCP:Code LIKE(RCP:Code) ! Queue Display Field
- RCP:RecipeNo LIKE(RCP:RecipeNo) ! Queue Display Field
- Position STRING(255) ! Queue POSITION Information
- END !End Queue Declaration
-
- BrowseQueue2 QUEUE !Queue Used by List when Browsing Records
- ING:Ingredient LIKE(ING:Ingredient) ! Queue Display Field
- ING:Measure LIKE(ING:Measure) ! Queue Display Field
- ING:Quantity LIKE(ING:Quantity) ! Queue Display Field
- Position STRING(255) ! Queue POSITION Information
- END !End Queue Declaration
- LocLen:BrowseQueue2 BYTE
-
-
- Screen WINDOW('Intermediate Browse Exercise'),AT(,,359,178),FONT('MS Sans Serif',8,,),CENTER,STATUS,SYSTEM,GRAY,MAX,RESIZE,MASK,MDI,IMM
- LIST,AT(5,34,207,73),MSG('Browsing Records'),ALRT(CtrlEnter),ALRT(InsertKey),ALRT(DeleteKey),USE(?List1),IMM,HVSCROLL,VCR,FORMAT(FORMAT:BrowseQueue1:Default),FROM(BrowseQueue1)
- LIST,AT(221,34,133,73),MSG('Browsing Records'),ALRT(CtrlEnter),ALRT(InsertKey),ALRT(DeleteKey),USE(?List2),IMM,NOBAR,VSCROLL,FROM(BrowseQueue2),FORMAT(FORMAT:BrowseQueue2:Default)
- BUTTON('&Mark'),AT(23,109,40,10),USE(?Mark)
- BUTTON('&Unmark'),AT(65,109,40,10),USE(?Unmark)
- BUTTON('Mark &All'),AT(107,109,40,10),USE(?MarkAll)
- BUTTON('&Clear All'),AT(149,109,40,10),USE(?UnmarkAll)
- PROMPT('Sort By:'),AT(3,4,28,10),USE(?ChangeOrder:Prompt)
- LIST,AT(32,4,80,10),USE(?ChangeOrder),FORMAT('160L@s40@'),DROP(4),FROM(DropBoxOrderQ)
- OPTION,AT(221,3,90,17),USE(?ChangeOrder2)
- RADIO('Ingredient'),AT(224,9),USE(?ChangeOrder2:Radio1)
- RADIO('Measure'),AT(270,9),USE(?ChangeOrder2:Radio2)
- END
- BUTTON('Close'),AT(314,165,40,10),USE(?Close)
- PROMPT('Search:'),AT(5,17,25,10),USE(?Search:Prompt)
- ENTRY(@S40),AT(32,17,80,10),MSG('Enter Search Criteria'),USE(Search)
- PROMPT('Search:'),AT(223,22,25,10),USE(?Search:Prompt:1)
- ENTRY(@S40),AT(251,22,68,10),MSG('Enter Search Criteria'),USE(Search2)
- BUTTON('Insert'),AT(234,151,40,10),USE(?Insert)
- BUTTON('Change'),AT(274,151,40,10),USE(?Change)
- BUTTON('Delete'),AT(314,151,40,10),USE(?Delete)
- PROMPT('&Recipe#:'),AT(13,126),USE(?RCP:RecipeNo:Prompt)
- PROMPT('&Recipe#:'),AT(233,111),USE(?ING:RecipeNo:Prompt)
- ENTRY(@N_5),AT(267,110),USE(ING:RecipeNo),READONLY
- ENTRY(@N_5),AT(47,125),USE(RCP:RecipeNo),READONLY
- PROMPT('&Name:'),AT(20,141),USE(?RCP:Name:Prompt)
- PROMPT('&Ingredient:'),AT(227,126),USE(?ING:Ingredient:Prompt)
- ENTRY(@S15),AT(267,124),USE(ING:Ingredient),READONLY
- ENTRY(@S20),AT(47,140),USE(RCP:Name),READONLY
- END
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Code Section !
- !--------------------------------------------------------------------------------------------------!
- CODE
-
- LocalRequest = GlobalRequest
- OriginalRequest = LocalRequest
- LocalResponse = RequestCancelled
- ForceRefresh = False
- CLEAR(GlobalRequest)
- CLEAR(GlobalResponse)
-
- IF INGREDIENT::Used = 0
- CheckOpen(INGREDIENT,1)
- END
- INGREDIENT::Used += 1
- IF RECIPE::Used = 0
- CheckOpen(RECIPE,1)
- END
- RECIPE::Used += 1
-
- OPEN(Screen)
- WindowOpened = True
- INIRestoreWindow('BrowseIntermediate','PTDEMO.INI')
- DO ResizeWindow !Call Resize Window Routine
- Screen{PROP:Imm} = 1 !Allow Resize Events to be Posted
- HIDE(?List1) !Delay Display of List Box
- HIDE(?List2) !Delay Display of List Box
- DO LoadSortOrders:BrowseQueue1
- DO LoadSortOrders:BrowseQueue2
- SELECT(?List1)
-
- ?List2{Prop:Alrt,250} = BSKey !Alert BackSpace Key for Incremental Locator
- ?List2{Prop:Alrt,249} = SpaceKey !Alert Space Key for Incremental Locator
-
- ACCEPT !Begin Processing Event Loop
- !
- IF SELECTED() THEN CurrentSelected = SELECTED(). !Save Current Field Selection
- CASE EVENT() !Process Events for the Window
- OF EVENT:OpenWindow
- IF NOT WindowInitialized
- DO InitializeWindow
- WindowInitialized = True
- END
- SELECT(FIRSTFIELD())
- UNHIDE(?List1) !Unhide Filled List Box
- UNHIDE(?List2) !Unhide Filled List Box
- OF EVENT:GainFocus
- IF NOT WindowInitialized
- WindowInitialized = True
- DO InitializeWindow
- ELSE
- ForceRefresh = True
- DO RefreshWindow
- END
- ELSE
- IF EVENT() = EVENT:Sized !IF Window Was Resized
- DO ResizeWindow ! Call Resize Window Routine
- END !End If
- END !End Events for Window
-
- CASE FIELD() !Process Events for Controls
- OF ?List1
- CASE EVENT()
- OF EVENT:Locate
- SELECT(?Search) !Select Locator Field
- OF EVENT:AlertKey
- DO StepSearch:BrowseQueue1
- END
- IF EVENT() <> EVENT:AlertKey AND | !If Not an Alert Key or a
- EVENT() <> EVENT:PreAlertKey AND | ! Pre-Alert Key Event and
- EVENT() <> EVENT:Selected ! Control not reselected
- Search = '' ! Clear the Search Input Field
- DISPLAY(?Search) ! Display Locator Field
- END !End If
- DO BrowseList:BrowseQueue1 !Fill Browse Area
- OF ?List2
- CASE EVENT()
- OF EVENT:AlertKey
- DO StepSearch:BrowseQueue2
- DO IncrementalSearch:BrowseQueue2
- END
- IF EVENT() <> EVENT:AlertKey AND | !If Not an Alert Key or a
- EVENT() <> EVENT:PreAlertKey AND | ! Pre-Alert Key Event and
- EVENT() <> EVENT:Selected ! Control not reselected
- LocLen:BrowseQueue2 = 0 ! Clear Locator Length
- Search2 = '' ! Clear the Search Input Field
- DISPLAY(?Search2) ! Display Locator Field
- END !End If
- DO BrowseList:BrowseQueue2 !Fill Browse Area
- OF ?Mark
- CASE EVENT()
- OF EVENT:Accepted
- GET(BrowseQueue1,CHOICE(?List1)) !Reget Current Record ID
- MQ1:RecipeNo = BrowseQueue1:RCP:RecipeNo !Prepare to Search for Marked Record
- GET(MarkQueue,MQ1:RecipeNo) !See if Record is Marked
- IF NOT MarkAllFlag !If Not Marking All Exceptions
- IF ERROR() ! If Record Not Marked
- BrowseQueue1:MarkStatus = 'Marked' ! Show Record as Marked in the List Box
- MQ1:RecipeNo = BrowseQueue1:RCP:RecipeNo ! Set up to Add Record to the Mark Queue
- ADD(MarkQueue,MQ1:RecipeNo) ! Add the Record to the Mark Queue
- PUT(BrowseQueue1) ! Update the Changes to the List Box
- END ! End If
- ELSE !Otherwise Mark Table is an Exception List
- IF NOT ERROR() ! If Record Not Marked
- BrowseQueue1:MarkStatus = 'Marked' ! Show Record as Marked in the List Box
- DELETE(MarkQueue) ! Delete the Record from the Mark Queue
- PUT(BrowseQueue1) ! Update the Changes to the List Box
- END ! End If
- END !End If
- SELECT(?List1) !Go Back to List Box After Button Press
- END
- OF ?Unmark
- CASE EVENT()
- OF EVENT:Accepted
- GET(BrowseQueue1,CHOICE(?List1)) !Reget Current Record ID
- MQ1:RecipeNo = BrowseQueue1:RCP:RecipeNo !Prepare to Search for Marked Record
- GET(MarkQueue,MQ1:RecipeNo) !See if Record is Marked
- IF NOT MarkAllFlag !If Not Marking All Exceptions
- IF NOT ERROR() ! If Record is Marked
- BrowseQueue1:MarkStatus = 'UnMarked' ! Show Record as Not Marked in the List Box
- DELETE(MarkQueue) ! Delete the Record from the Mark Queue
- PUT(BrowseQueue1) ! Update the Changes to the List Box
- END ! End If
- ELSE !Otherwise Mark Table is an Exception List
- IF ERROR() ! If Record is Marked
- BrowseQueue1:MarkStatus = 'UnMarked' ! Show Record as Not Marked in the List Box
- MQ1:RecipeNo = BrowseQueue1:RCP:RecipeNo ! Set up to Add Record to the Mark Queue
- ADD(MarkQueue,MQ1:RecipeNo) ! Add the Record to the Mark Queue
- PUT(BrowseQueue1) ! Update the Changes to the List Box
- END ! End If
- END !End If
- SELECT(?List1) !Go Back to List Box After Button Press
- END
- OF ?MarkAll
- CASE EVENT()
- OF EVENT:Accepted
- MarkAllFlag = 1 !Mark Queue is Now an Exception List
- FREE(MarkQueue) !Mark All Records
- LOOP Rec# = 1 TO RECORDS(BrowseQueue1) !Loop Through the List Boxes Records
- GET(BrowseQueue1,Rec#) ! Read the Queue Record
- BrowseQueue1:MarkStatus = 'Marked' ! Show Record as Marked in the List Box
- PUT(BrowseQueue1) ! Update the Changes to the List Box
- END !End Loop
- SELECT(?List1) !Go Back to List Box After Button Press
- END
- OF ?UnmarkAll
- CASE EVENT()
- OF EVENT:Accepted
- MarkAllFlag = 0 !Mark Queue is Now a List of Marked Records
- FREE(MarkQueue) !UnMark All Records
- LOOP Rec# = 1 TO RECORDS(BrowseQueue1) !Loop Through the List Boxes Records
- GET(BrowseQueue1,Rec#) ! Read the Queue Record
- BrowseQueue1:MarkStatus = 'UnMarked' ! Show Record as Not Marked in the List Box
- PUT(BrowseQueue1) ! Update the Changes to the List Box
- END !End Loop
- SELECT(?List1) !Go Back to List Box After Button Press
- END
- OF ?ChangeOrder
- CASE EVENT()
- OF EVENT:Accepted
- GET(DropBoxOrderQ,CHOICE()) !Get Order settings from Sort Orders Queue
- IF NOT ERROR() !IF Valid Choice was Selected
- SQ1:SortOrder = CHOICE() ! Set sort order
- ?Search{PROP:Text} = SQ1:SearchPicture ! Set Picture for Search Field
- ?List1{PROP:Format} = SQ1:OrderFormat ! Set number of rows in list box
- TC_PROP:BRW(?List1,TCPROP:Rows,?List1{PROP:Items}) ! Reset number of rows property
- TC_PROP:BRW(?List1,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to start redisplay with a search by key
- TC_PROP:BRW(?List1,TCPROP:SetToPosition,2) ! Set Redisplay at Key Position in Queue
- DO BrowseList:BrowseQueue1 ! Call BrowseList and Execute Redisplay
- END !End
- END
- OF ?ChangeOrder2
- CASE EVENT()
- OF EVENT:Accepted
- GET(OptBoxOrderQ:BrowseQueue2,CHOICE()) !Get Order settings from Sort Orders Queue
- IF NOT ERROR() !IF Valid Choice was Selected
- SQ7:SortOrder = CHOICE() ! Set sort order
- ?Search2{PROP:Text} = SQ7:SearchPicture ! Set Picture for Search Field
- ?List2{PROP:Format} = SQ7:OrderFormat ! Set number of rows in list box
- TC_PROP:BRW(?List2,TCPROP:Rows,?List2{PROP:Items}) ! Reset number of rows property
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to start redisplay with a search by key
- TC_PROP:BRW(?List2,TCPROP:SetToPosition,2) ! Set Redisplay at Key Position in Queue
- DO BrowseList:BrowseQueue2 ! Call BrowseList and Execute Redisplay
- END !End
- END
- OF ?Close
- CASE EVENT()
- OF EVENT:Accepted
- LocalResponse = RequestCancelled
- POST(Event:CloseWindow)
- END
- OF ?Search
- CASE EVENT()
- OF EVENT:Accepted
- DO EntrySearch:BrowseQueue1
- END
- OF ?Search2
- CASE EVENT()
- OF EVENT:Accepted
- DO EntrySearch:BrowseQueue2
- END
- OF ?Insert
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:InsertRecord,TC:BRW:ActiveList) !Send Insert Message to List Box
- END
- OF ?Change
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:ChangeRecord,TC:BRW:ActiveList) !Send Change Message to List Box
- END
- OF ?Delete
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:DeleteRecord,TC:BRW:ActiveList) !Send Delete Message to List Box
- CASE TC:BRW:ActiveList !For the Currently Active List
- OF ?List1 !On List 1 (Template Instance 1)
- IF RECORDS(MarkQueue) OR MarkAllFlag !If Records are Marked
- ! Confirm Delete of Marked
- Confirm# = MESSAGE('Delete ALL MARKED Recipes?',,|
- ICON:Question,Button:Yes+Button:No,|
- Button:Yes,0)
- IF Confirm# = Button:No OR KEYCODE() = EscKey ! If Not Confirmed
- CYCLE ! Don't Delete
- END ! End IF
- !
- SETCURSOR(CURSOR:Wait) ! Show Hour-Glass Cursor
- IF MarkAllFlag ! If All Records Marked
- SET(RCP:Key_RecipeNo) ! Process Entire File
- LOOP UNTIL EOF(Recipe) ! Read and Delete all Records
- NEXT(Recipe) ! that are NOT in MarkQueue
- MQ1:RecipeNo = RCP:RecipeNo !
- GET(MarkQueue,MQ1:RecipeNo) !
- IF NOT ERROR() THEN CYCLE. !
- Err# = RIDelete:Recipe() !
- END !
- ELSE ! Otherwise
- LOOP Rec# = 1 TO RECORDS(MarkQueue) ! Read and Delete Only Records
- GET(MarkQueue,Rec#) ! that ARE FOUND in MarkQueue
- RCP:RecipeNo = MQ1:RecipeNo !
- GET(Recipe,RCP:Key_RecipeNo) !
- IF ERROR() THEN CYCLE. !
- Err# = RIDelete:Recipe() !
- END !
- END ! End If All Records Marked
- FREE(MarkQueue) !
- CLEAR(MarkAllFlag) !
- SETCURSOR(CURSOR:Arrow) ! Restore Normal Windows Cursor
- POST(EVENT:ScrollTop,?List1) ! Redisplay Page
- CYCLE !
- END !End If Records Are Marked
- END !
- END
- END !End Events for Controls
- END !End Event Loop
- !
- DO ProcedureReturn !Cleanup and Exit the Procedure
-
-
- !--------------------------------------------------------------------------------------------------!
- ! InitializeWindow Routine !
- ! !
- ! Initialize and Display window for the first time. !
- !--------------------------------------------------------------------------------------------------!
- InitializeWindow ROUTINE
- DO RefreshWindow
-
-
- !--------------------------------------------------------------------------------------------------!
- ! RefreshWindow Routine !
- ! !
- ! Redisplays the fields for the window. !
- !--------------------------------------------------------------------------------------------------!
- RefreshWindow ROUTINE
-
- IF Screen{Prop:AcceptAll} THEN EXIT.
- TC_PROP:BRW(?List1,TCPROP:Action,TCACTION:Refresh)
- TC_PROP:BRW(?List1,TCPROP:SetToItem,CHOICE(?List1))
- TC_PROP:BRW(?List1,TCPROP:DontSelect,True)
- DO BrowseList:BrowseQueue1
- DISPLAY()
- ForceRefresh = False
-
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! ResizeWindow Routine !
- ! !
- ! Resize the Window and Redsiplay any list boxes that were resized.Resized List Boxes !
- !--------------------------------------------------------------------------------------------------!
- ResizeWindow ROUTINE
-
- IF WinWidth = Screen{PROP:Width} AND | !If Window Width was not Changed AND
- WinHeight = Screen{PROP:Height} ! Window Height was not Changed
- EXIT ! Resize Not Needed - Exit Routine
- END !End If
- !
- TC_ResizeWin(?List1,WinWidth,WinHeight,?List2) !Reset Window Size
- WinWidth = Screen{PROP:Width} !Save Current Window Width
- WinHeight = Screen{PROP:Height} !Save Current Window Height
- !
- IF NOT WindowInitialized THEN EXIT. !Refresh not needed if window not Init.
- !
- TC_PROP:BRW(?List2,TCPROP:Rows,?List2{PROP:Items}) !Reset Number of Rows in List Box
- TC_PROP:BRW(?List2,TCPROP:SetToPosition,3) !Set for Redisplay at Key Position
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) !Tell Browse to Redisplay
- DO BrowseList:BrowseQueue2 !Fill Browse Area
- !
- TC_PROP:BRW(?List1,TCPROP:Rows,?List1{PROP:Items}) !Reset Number of Rows in List Box
- TC_PROP:BRW(?List1,TCPROP:SetToPosition,3) !Set for Redisplay at Key Position
- TC_PROP:BRW(?List1,TCPROP:Action,TCACTION:Refresh) !Tell Browse to Redisplay
- DO BrowseList:BrowseQueue1 !Fill Browse Area
- !
- IF CurrentSelected THEN SELECT(CurrentSelected). !Reslect Current Field
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! BrowseList:BrowseQueue1 Routine !
- ! !
- ! This routine calls the browser to do a page-loaded display from a file. !
- !--------------------------------------------------------------------------------------------------!
- BrowseList:BrowseQueue1 ROUTINE
-
- IF NOT TC_PROP:BRW(?List1,TCPROP:Initialized) !If Browse Not Initialized
- IF NOT TC_InitBrowse(?List1,THREAD()) THEN EXIT. ! Initialize Browse Processing for List Box
- IF LocalRequest = SelectRecord ! If Browse Procedure Called as a Lookup
- TC_PROP:BRW(?List1,TCPROP:SetToPosition,1) ! Start Lookup on Current Record
- TC_PROP:BRW(?List1,TCPROP:SelectRecord,True) ! Set Double Click to Select Record
- END ! End If
- END !End If
- !
- LOOP !Process File Browse Loop
- CASE SQ1:SortOrder !Browse for Current Sort Order
- OF 1 !Sort Order Is By Name
- TC_Browse(?List1 ,| ! Browse Handle
- RECIPE ,| ! File Name
- RCP:RECORD ,| ! Record Area
- RCP:Key_Name ,| ! Key Order for Display
- BrowseQueue1 ,| ! Queue Name for List
- BrowseQueue1:Position ) ! Record Position in Key Order
- OF 2 !Sort Order Is Beef Dishes Only
- TC_Browse(?List1 ,| ! Browse Handle
- RECIPE ,| ! File Name
- RCP:RECORD ,| ! Record Area
- RCP:Key_Name ,| ! Key Order for Display
- BrowseQueue1 ,| ! Queue Name for List
- BrowseQueue1:Position ) ! Record Position in Key Order
- OF 3 !Sort Order Is Chicken Dishes Only
- TC_Browse(?List1 ,| ! Browse Handle
- RECIPE ,| ! File Name
- RCP:RECORD ,| ! Record Area
- RCP:Key_Name ,| ! Key Order for Display
- BrowseQueue1 ,| ! Queue Name for List
- BrowseQueue1:Position ) ! Record Position in Key Order
- END !End Case On Sort Orders
-
- CASE TC_PROP:BRW(?List1,TCPROP:Action) !Process Browse Actions
- OF TCACTION:FillQueue !Fill List Queue Action
- CASE SQ1:SortOrder !Filter for Current Sort Order
- OF 2 !Check Filter Condition
- IF NOT(INSTRING('BEEF',UPPER(RCP:Name),1)) ! If Filter Condition Not Met
- TC_PROP:BRW(?List1,TCPROP:SkipRecord,1) ! Tell Browse to Skip Record
- CYCLE ! No need to fill the Queue
- END ! End If
- OF 3 !Check Filter Condition
- IF NOT(INSTRING('CHICKEN',UPPER(RCP:Name),1)) ! If Filter Condition Not Met
- TC_PROP:BRW(?List1,TCPROP:SkipRecord,1) ! Tell Browse to Skip Record
- CYCLE ! No need to fill the Queue
- END ! End If
- END !End Case
- MQ1:RecipeNo = RCP:RecipeNo ! Prepare to Search for Marked Record
- GET(MarkQueue,MQ1:RecipeNo) ! See if Record is Marked
- IF (NOT MarkAllFlag AND NOT ERROR()) OR | ! If Record is Marked
- (MarkAllFlag AND ERROR()) !
- MarkStatus = 'Marked' ! Show Record as Marked
- ELSE ! Otherwise
- MarkStatus = 'UnMarked' ! Show Record as Not Marked
- END ! End If
- BrowseQueue1:MarkStatus = MarkStatus ! Move Data to Queue
- BrowseQueue1:RCP:Code = RCP:Code ! Move Data to Queue
- BrowseQueue1:RCP:Name = RCP:Name ! Move Data to Queue
- BrowseQueue1:RCP:RecipeNo = RCP:RecipeNo ! Move Data to Queue
- !
- OF TCACTION:InsertRecord !Insert Record Action
- GET(RECIPE,0) ! Clear Pending Record
- CLEAR(RCP:RECORD) ! Clear Record Area
- GlobalRequest = InsertRecord ! Tell Form To Insert Record
- UpdateRecipe ! Insert Record
- IF GlobalResponse = RequestCompleted ! If Record Added
- TC_PROP:BRW(?List1,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List1,TCPROP:SetToPosition,1) ! Record at Current Key Positon
- END ! End If
- !
- OF TCACTION:ChangeRecord !Change Record Action
- GlobalRequest = ChangeRecord ! Tell Form To Change Record
- UpdateRecipe ! Change Record
- IF GlobalResponse = RequestCompleted ! If Record Added
- TC_PROP:BRW(?List1,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List1,TCPROP:SetToPosition,1) ! Record at the Current Key Positon
- END ! End If
- !
- OF TCACTION:DeleteRecord !Delete Record Action
- GlobalRequest = DeleteRecord ! Tell Form To Delete Record
- UpdateRecipe ! Delete Record
- IF GlobalResponse = RequestCompleted ! If Record Deleted
- TC_PROP:BRW(?List1,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List1,TCPROP:SetToItem,True) ! Record at the Current Item
- END ! End If
- !
- OF TCACTION:SelectRecord !Select Record Action
- LocalResponse = RequestCompleted ! Lookup was completed
- POST(Event:CloseWindow) ! Return Selected Record to Caller
- !
- OF TCACTION:DisplayFields !Display Fields Action
- IF TC_PROP:BRW(?List2,TCPROP:Initialized) ! If Browse is Initialized
- TC_PROP:BRW(?List2,TCPROP:Action,0) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:DontSelect,1) ! Tell Browse not to Select the List Box
- END ! End If
- DO BrowseList:BrowseQueue2 ! Call Browse Routine for the List Box
- TC:BRW:ActiveList = ?List1 ! Reset List Box as Being Active
- DISPLAY() ! Display All Fields
- IF RECORDS(BrowseQueue1) ! If Records Displayed
- ENABLE(?List2) ! Enable Child List Box
- ENABLE(?Mark) ! Enable the Mark Button
- ENABLE(?Unmark) ! Enable the Unmark Button
- ENABLE(?MarkAll) ! Enable the Mark All Button
- ENABLE(?UnmarkAll) ! Enable the Unmark All Button
- ENABLE(?Change) ! Enable Change Button
- ENABLE(?Delete) ! Enable Delete Button
- ELSE ! Else
- DISABLE(?List2) ! Disable Child List Box
- DISABLE(?Mark) ! Disable the Mark Button
- DISABLE(?Unmark) ! Disable the Unmark Button
- DISABLE(?MarkAll) ! Disable the Mark All Button
- DISABLE(?UnmarkAll) ! Disable the Unmark All Button
- DISABLE(?Change) ! Disable Change Button
- DISABLE(?Delete) ! Disable Delete Button
- END ! End If
- !
- OF TCACTION:ExitBrowse !Exit Browse Action
- BREAK !
- END !End Process Browse Actions
- END !End Process File Browse Loop
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! EntrySearch:BrowseQueue1 Routine !
- ! !
- ! This routine processes a Entry search for ?List1 !
- !--------------------------------------------------------------------------------------------------!
- EntrySearch:BrowseQueue1 ROUTINE
-
- CASE SQ1:SortOrder !Setup Search for Current Sort Order
- OF 1 !For Current Sort Order
- RCP:Name = Search ! Fill Search Key
- OF 2 !For Current Sort Order
- RCP:Name = Search ! Fill Search Key
- OF 3 !For Current Sort Order
- RCP:Name = Search ! Fill Search Key
- ELSE !Otherwise if not using a entry locator
- EXIT ! Exit Routine
- END !End Case
-
- Search = '' !Clear Search Input Field
- DISPLAY(?Search) !
- TC_PROP:BRW(?List1,TCPROP:Action,TCACTION:Refresh) !Tell Browse to Redisplay
- TC_PROP:BRW(?List1,TCPROP:SetToKey,True) !Redisplay after searching by key
- SELECT(?List1) !Reselect Main List Box
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! StepSearch:BrowseQueue1 Routine !
- ! !
- ! This routine processes a step search for ?List1 !
- !--------------------------------------------------------------------------------------------------!
- StepSearch:BrowseQueue1 ROUTINE
-
- IF INRANGE(KEYCODE(),KeyPad0,KeyPad9) !If Key is a numeric keypad key
- SETKEYCODE(KEYCODE()-48) ! Convert to regular numeric key
- END !End If
- IF (INRANGE(KEYCODE(),Key0,ZKey) OR | !If Key is a lower case 0-Z Key
- INRANGE(KEYCODE(),Shift0,ShiftZ)) ! or it's a upper case 0-Z Key
- CASE SQ1:SortOrder ! Setup Locator for Current Sort Order
- OF 1 ! For Sort Orders Not Using Incremental Search
- RCP:Name = CHR(KEYCODE()) ! Move character into locator
- OF 2 ! For Sort Orders Not Using Incremental Search
- RCP:Name = CHR(KEYCODE()) ! Move character into locator
- OF 3 ! For Sort Orders Not Using Incremental Search
- RCP:Name = CHR(KEYCODE()) ! Move character into locator
- END ! End Case
- TC_PROP:BRW(?List1,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List1,TCPROP:SetToKey,True) ! Redisplay after searching by key
- END !End If
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! LoadSortOrders:BrowseQueue1 Routine !
- ! !
- ! This routine loads the available sort options into the DropBoxOrderQ !
- !--------------------------------------------------------------------------------------------------!
- LoadSortOrders:BrowseQueue1 ROUTINE
-
- FREE(DropBoxOrderQ) !Make sure queue is empty
-
- SQ1:SearchPicture = '@S20' !Set Picture for Search Field
- SQ1:OrderName = 'By Name' !Set Name of Sort Order
- SQ1:OrderFormat = FORMAT:BrowseQueue1:Default !Set Format String for Sort Order
- ADD(DropBoxOrderQ) !Add the option
-
- SQ1:SearchPicture = '@S20' !Set Picture for Search Field
- SQ1:OrderName = 'Beef Dishes Only' !Set Name of Sort Order
- SQ1:OrderFormat = FORMAT:BrowseQueue1:Default !Set Format String for Sort Order
- ADD(DropBoxOrderQ) !Add the option
-
- SQ1:SearchPicture = '@S20' !Set Picture for Search Field
- SQ1:OrderName = 'Chicken Dishes Only' !Set Name of Sort Order
- SQ1:OrderFormat = FORMAT:BrowseQueue1:Default !Set Format String for Sort Order
- ADD(DropBoxOrderQ) !Add the option
-
- SQ1:SortOrder = 1 !Default to Sort Order #1
- GET(DropBoxOrderQ,SQ1:SortOrder) !Get Sort Order Entry from Queue
- SELECT(?ChangeOrder,SQ1:SortOrder) !Set Initial Sort Order for Drop Box
- ?Search{PROP:Text} = SQ1:SearchPicture !Set Initial Picture for Search Field
- ?List1{PROP:Format} = SQ1:OrderFormat !Set Initial Format for List Box
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! BrowseList:BrowseQueue2 Routine !
- ! !
- ! This routine calls the browser to do a page-loaded display from a file. !
- !--------------------------------------------------------------------------------------------------!
- BrowseList:BrowseQueue2 ROUTINE
-
- IF NOT TC_PROP:BRW(?List2,TCPROP:Initialized) !If Browse Not Initialized
- IF NOT TC_InitBrowse(?List2,THREAD()) THEN EXIT. ! Initialize Browse Processing for List Box
- TC_PROP:BRW(?List2,TCPROP:InsertMode,1) ! Set Insert Mode to Top of List
- TC_PROP:BRW(?List2,TCPROP:DontSelect,1) ! Tell Browse not to Select the List Box
- IF LocalRequest = SelectRecord ! If Browse Procedure Called as a Lookup
- TC_PROP:BRW(?List2,TCPROP:SetToPosition,1) ! Start Lookup on Current Record
- TC_PROP:BRW(?List2,TCPROP:SelectRecord,True) ! Set Double Click to Select Record
- END ! End If
- END !End If
- !
- LOOP !Process File Browse Loop
- CASE SQ7:SortOrder !Browse for Current Sort Order
- OF 1 !Sort Order Is By Ingredient
- TC_Browse(?List2 ,| ! Browse Handle
- INGREDIENT ,| ! File Name
- ING:RECORD ,| ! Record Area
- ING:Key_Ingredient ,| ! Key Order for Display
- BrowseQueue2 ,| ! Queue Name for List
- BrowseQueue2:Position ,| ! Record Position in Key Order
- ING:RecipeNo ,| ! Range Field
- RCP:RecipeNo ,| ! Match Range - Low Value
- RCP:RecipeNo ) ! Match Range - High Value
- OF 2 !Sort Order Is By Measure
- TC_Browse(?List2 ,| ! Browse Handle
- INGREDIENT ,| ! File Name
- ING:RECORD ,| ! Record Area
- ING:Key_Measure ,| ! Key Order for Display
- BrowseQueue2 ,| ! Queue Name for List
- BrowseQueue2:Position ,| ! Record Position in Key Order
- ING:RecipeNo ,| ! Range Field
- RCP:RecipeNo ,| ! Match Range - Low Value
- RCP:RecipeNo ) ! Match Range - High Value
- END !End Case On Sort Orders
-
- CASE TC_PROP:BRW(?List2,TCPROP:Action) !Process Browse Actions
- OF TCACTION:FillQueue !Fill List Queue Action
- MQ1:RecipeNo = RCP:RecipeNo ! Prepare to Search for Marked Record
- GET(MarkQueue,MQ1:RecipeNo) ! See if Record is Marked
- IF (NOT MarkAllFlag AND NOT ERROR()) OR | ! If Record is Marked
- (MarkAllFlag AND ERROR()) !
- MarkStatus = 'Marked' ! Show Record as Marked
- ELSE ! Otherwise
- MarkStatus = 'UnMarked' ! Show Record as Not Marked
- END ! End If
- BrowseQueue2:ING:Ingredient = ING:Ingredient ! Move Data to Queue
- BrowseQueue2:ING:Measure = ING:Measure ! Move Data to Queue
- BrowseQueue2:ING:Quantity = ING:Quantity ! Move Data to Queue
- !
- OF TCACTION:InsertRecord !Insert Record Action
- GET(INGREDIENT,0) ! Clear Pending Record
- CLEAR(ING:RECORD) ! Clear Record Area
- DISABLE(?ChangeOrder2) ! Disable Change Order Control
- BrowseIntermediate:Update:BrowseQueue2(?List2,TCACTION:InsertRecord,SQ7:SortOrder) ! Call In-Line Update Procedure
- ENABLE(?ChangeOrder2) ! Enable Change Order Control
- IF GlobalResponse = RequestCompleted ! If Update Completed
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToPosition,2) ! Record at the current positon
- ELSE ! Otherwise
- DELETE(BrowseQueue2) ! Delete Cancelled Queue Record
- POST(EVENT:ScrollTop,?List2) ! Redisplay First Page of Records
- END ! End If
- !
- OF TCACTION:ChangeRecord !Change Record Action
- DISABLE(?ChangeOrder2) ! Disable Change Order Control
- BrowseIntermediate:Update:BrowseQueue2(?List2,TCACTION:ChangeRecord,SQ7:SortOrder) ! Call In-Line Update Procedure
- ENABLE(?ChangeOrder2) ! Enable Change Order Control
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToPosition,2) ! Record at the current positon
- !
- OF TCACTION:DeleteRecord !Delete Record Action
- DISABLE(?ChangeOrder2) ! Disable Change Order Control
- BrowseIntermediate:Update:BrowseQueue2(?List2,TCACTION:DeleteRecord,SQ7:SortOrder) ! Call In-Line Update Procedure
- ENABLE(?ChangeOrder2) ! Enable Change Order Control
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToItem,True) ! Record at the current positon
- !
- OF TCACTION:SelectRecord !Select Record Action
- LocalResponse = RequestCompleted ! Lookup was completed
- POST(Event:CloseWindow) ! Return Selected Record to Caller
- !
- OF TCACTION:DisplayFields !Display Fields Action
- DISPLAY() ! Display All Fields
- !
- OF TCACTION:ExitBrowse !Exit Browse Action
- BREAK !
- END !End Process Browse Actions
- END !End Process File Browse Loop
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! EntrySearch:BrowseQueue2 Routine !
- ! !
- ! This routine processes a Entry search for ?List2 !
- !--------------------------------------------------------------------------------------------------!
- EntrySearch:BrowseQueue2 ROUTINE
-
- CASE SQ7:SortOrder !Setup Search for Current Sort Order
- OF 1 !For Current Sort Order
- ING:Ingredient = Search2 ! Fill Search Key
- OF 2 !For Current Sort Order
- ING:Measure = Search2 ! Fill Search Key
- ELSE !Otherwise if not using a entry locator
- EXIT ! Exit Routine
- END !End Case
-
- LocLen:BrowseQueue2 = 0 !Clear Locator Length
- Search2 = '' !Clear Search Input Field
- DISPLAY(?Search2) !
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) !Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToKey,True) !Redisplay after searching by key
- SELECT(?List2) !Reselect Main List Box
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! StepSearch:BrowseQueue2 Routine !
- ! !
- ! This routine processes a step search for ?List2 !
- !--------------------------------------------------------------------------------------------------!
- StepSearch:BrowseQueue2 ROUTINE
-
- CASE SQ7:SortOrder !Setup Search for Current Sort Order
- OF 1 !For Sort Orders Not Using Step Search
- EXIT ! Exit Routine
- END !End Case
-
- IF INRANGE(KEYCODE(),KeyPad0,KeyPad9) !If Key is a numeric keypad key
- SETKEYCODE(KEYCODE()-48) ! Convert to regular numeric key
- END !End If
- IF (INRANGE(KEYCODE(),Key0,ZKey) OR | !If Key is a lower case 0-Z Key
- INRANGE(KEYCODE(),Shift0,ShiftZ)) ! or it's a upper case 0-Z Key
- CASE SQ7:SortOrder ! Setup Locator for Current Sort Order
- OF 2 ! For Sort Orders Not Using Incremental Search
- ING:Measure = CHR(KEYCODE()) ! Move character into locator
- END ! End Case
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToKey,True) ! Redisplay after searching by key
- END !End If
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! IncrementalSearch:BrowseQueue2 Routine !
- ! !
- ! This routine processes a incremental search for ?List2 !
- !--------------------------------------------------------------------------------------------------!
- IncrementalSearch:BrowseQueue2 ROUTINE
-
- CASE SQ7:SortOrder !Setup Search for Current Sort Order
- OF 2 !For Sort Orders Not Using Incremental Search
- EXIT ! Exit Routine
- END !End Case
-
- IF INRANGE(KEYCODE(),KeyPad0,KeyPad9) !If Key is a numeric keypad key
- SETKEYCODE(KEYCODE()-48) ! Convert to regular numeric key
- END !End If
- IF (INRANGE(KEYCODE(),Key0,ZKey) OR | !If Key is a lower case 0-Z Key
- INRANGE(KEYCODE(),187,192) OR | ! or other usable characters
- INRANGE(KEYCODE(),Shift0,ShiftZ) OR | ! or it's a upper case 0-Z Key
- KEYCODE() = BSKey OR KEYCODE() = SpaceKey) ! or it's the BackSpace or Space Key
- IF KEYCODE() = BSKey ! If BackSpace Key Pressed
- IF LocLen:BrowseQueue2 ! If Not First Position in Locator
- LocLen:BrowseQueue2 -= 1 ! Substract 1 from Length
- Search2 = SUB(Search2,1,LocLen:BrowseQueue2) ! Remove Last Character from Search
- END ! End If
- ELSIF KEYCODE() = SpaceKey ! If BackSpace Key Pressed
- IF LocLen:BrowseQueue2 < LEN(Search2) ! If Not Last Position in Locator
- LocLen:BrowseQueue2 += 1 ! Add 1 to Length
- END ! End If
- ELSE
- IF LocLen:BrowseQueue2 < LEN(Search2) ! If Not Last Position in Locator
- Search2 = SUB(Search2,1,LocLen:BrowseQueue2) & CHR(KEYCHAR()) ! Add Character to Search
- LocLen:BrowseQueue2 += 1 ! Add 1 to Length
- END ! End if
- END ! End
- CASE SQ7:SortOrder ! Setup Locator for Current Sort Order
- OF 1 ! For Sort Orders Not Using Incremental Search
- ING:Ingredient = Search2 ! Fill Search Key
- END ! End Case
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToKey,True) ! Redisplay after searching by key
- ELSE !Else
- LocLen:BrowseQueue2 = 0 ! Clear Locator Length
- Search2 = '' ! Clear the Search Input Field
- END !End If
- DISPLAY(?Search2) !Display Locator Field
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! LoadSortOrders:BrowseQueue2 Routine !
- ! !
- ! This routine loads the available sort options into the OptBoxOrderQ:BrowseQueue2 !
- !--------------------------------------------------------------------------------------------------!
- LoadSortOrders:BrowseQueue2 ROUTINE
-
- FREE(OptBoxOrderQ:BrowseQueue2) !Make sure queue is empty
-
- SQ7:SearchPicture = '@S15' !Set Picture for Search Field
- SQ7:OrderName = 'By Ingredient' !Set Name of Sort Order
- SQ7:OrderFormat = FORMAT:BrowseQueue2:Order1 !Set Format String for Sort Order
- ADD(OptBoxOrderQ:BrowseQueue2) !Add the option
-
- SQ7:SearchPicture = '@S8' !Set Picture for Search Field
- SQ7:OrderName = 'By Measure' !Set Name of Sort Order
- SQ7:OrderFormat = FORMAT:BrowseQueue2:Order2 !Set Format String for Sort Order
- ADD(OptBoxOrderQ:BrowseQueue2) !Add the option
-
- SQ7:SortOrder = 1 !Default to Sort Order #1
- GET(OptBoxOrderQ:BrowseQueue2,SQ7:SortOrder) !Get Sort Order Entry from Queue
- SELECT(?ChangeOrder2,SQ7:SortOrder) !Set Initial Sort Order for Drop Box
- ?Search2{PROP:Text} = SQ7:SearchPicture !Set Initial Picture for Search Field
- ?List2{PROP:Format} = SQ7:OrderFormat !Set Initial Format for List Box
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! ProcedureReturn Routine !
- ! !
- ! End of procedure cleanup and exit. !
- !--------------------------------------------------------------------------------------------------!
- ProcedureReturn ROUTINE
-
- INGREDIENT::Used -= 1
- IF INGREDIENT::Used = 0 THEN CLOSE(INGREDIENT).
- RECIPE::Used -= 1
- IF RECIPE::Used = 0 THEN CLOSE(RECIPE).
-
- IF WindowOpened
- INISaveWindow('BrowseIntermediate','PTDEMO.INI')
- CLOSE(Screen)
- END
-
- FREE(DropBoxOrderQ) !Release Memory use by SortOrder Queue
- FREE(BrowseQueue1) !Release Memory use by Browse Queue
- FREE(OptBoxOrderQ:BrowseQueue2) !Release Memory use by SortOrder Queue
- FREE(BrowseQueue2) !Release Memory use by Browse Queue
- FREE(MarkQueue) !Release Memory use by Mark Records Queue
-
- GlobalResponse = LocalResponse
- RETURN
-
-
- !==================================================================================================!
- ! !
- ! BrowseIntermediate:Update:BrowseQueue2 Procedure !
- ! ------------------------------------ !
- ! FILE NAME : INGREDIENT !
- ! LIST CONTROL: ?List2 !
- ! FROM QUEUE : BrowseQueue2 !
- ! !
- !==================================================================================================!
- BrowseIntermediate:Update:BrowseQueue2 PROCEDURE(ListControl,UpdateAction,SortOrder,AbortButton,SaveButton)
-
- FieldOrder1 EQUATE('1,2,3') !Field Order for Sort Order 1
- FieldOrder2 EQUATE('2,3,1') !Field Order for Sort Order 2
-
- ?ING:Ingredient EQUATE(101) !Set Field Number for ING:Ingredient
- ?ING:Measure EQUATE(102) !Set Field Number for ING:Measure
- ?ING:Quantity EQUATE(103) !Set Field Number for ING:Quantity
-
- InLineFieldSetup GROUP
- LONG(CREATE:Entry) !Control Type for ?ING:Ingredient
- LONG(CREATE:DropList) !Control Type for ?ING:Measure
- LONG(CREATE:Spin) !Control Type for ?ING:Quantity
- END
- InLineFields LONG,DIM(3),OVER(InLineFieldSetup)
-
- LocalResponse LONG,AUTO
- SAVE:ING:RECORD STRING(SIZE(ING:RECORD))
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Code Section !
- !--------------------------------------------------------------------------------------------------!
- CODE
-
- LocalResponse = RequestCancelled !Default to Request Cancelled
- CASE UpdateAction !Process Setup for Update Actions
- OF TCACTION:InsertRecord !On Insert New Record
- ING:RecipeNo = RCP:RecipeNo
- SAVE:ING:RECORD = ING:RECORD ! Save the Current Record
- ING:Quantity = 1 ! Prime Field
- !
- OF TCACTION:ChangeRecord !On Change Record
- SAVE:ING:RECORD = ING:RECORD ! Save the Current Record
- !
- OF TCACTION:DeleteRecord !On Delete Record
- DO DeleteRecord ! Delete the Record
- GlobalResponse = LocalResponse ! Set Global Response
- RETURN ! Exit Update Procedure
- END !End Case
- !
- ListControl{PROP:NoBar} = 1 !Turn Off Point Bar
- !
- LOOP !Process InLine Actions
- TC:INL:FirstField = ?ING:Ingredient !Set First Field Number
- EXECUTE SortOrder !Edit by Sort Order
- TC_InLine(ListControl,InLineFields[],FieldOrder1) !Call InLine Editing
- TC_InLine(ListControl,InLineFields[],FieldOrder2) !Call InLine Editing
- END !End Execute
- !
- CASE TC:INL:Action !Process InLine Actions
- OF TCACTION:SetFields !Set Field Properties Action
- !--------- ?ING:Ingredient ---------
- ?ING:Ingredient{PROP:Use} = ING:Ingredient
- ?ING:Ingredient{PROP:Msg} = 'Enter an Ingredient'
-
- !--------- ?ING:Measure ---------
- ?ING:Measure{PROP:Use} = ING:Measure
- ?ING:Measure{PROP:Msg} = 'Select a Measure'
- ?ING:Measure{PROP:Drop} = 7
- ?ING:Measure{PROP:From} = 'cup|gallon|lb|ounce|pint|tsp'
- ?ING:Measure{PROP:Format} = '32L@S8@'
-
- !--------- ?ING:Quantity ---------
- ?ING:Quantity{PROP:Use} = ING:Quantity
- ?ING:Quantity{PROP:Msg} = 'Select a Quantity'
- ?ING:Quantity{PROP:RangeHigh} = 99
- ?ING:Quantity{PROP:RangeLow} = 1
- ?ING:Quantity{PROP:Step} = 1
-
- OF TCACTION:SetHotKeys !Set Hot Keys Action
- TC:INL:AbortKey = EscKey ! Set Cancel Key
- TC:INL:SaveKey = CtrlEnter ! Set Save Key
-
- OF TCACTION:FieldEdits !Process Field Edits Action
- CASE TC:INL:Field
- OF ?ING:Measure
- IF NOT ING:Measure
- BEEP
- TC:INL:AbortUpdate = ?ING:Measure
- END
- END
-
- OF TCACTION:UpdateRecord !Update Record Action
- IF SAVE:ING:RECORD = ING:RECORD !If the Record was Not Changed
- LocalResponse = RequestCompleted ! Set Local Response to Completed
- CYCLE ! Nothing to Save - Exit In-Line
- END !End If
- LOOP !Attempt to Update Until Done or Canceled
- Error# = DUPLICATE(INGREDIENT) ! Test For Duplicate Key
- IF Error# ! If Duplicate Key Error
- Button# = MESSAGE('Updating this record creates a duplicate entry!', |
- 'Duplicate Key Error',ICON:Exclamation,Button:OK,Button:OK,0)
- ELSE ! Otherwise
- SETCURSOR(Cursor:Wait) ! Show Hour-Glass Cursor
- IF UpdateAction = TCACTION:InsertRecord ! If Inserting a New Record
- ADD(INGREDIENT) ! Add the Record
- Error# = ERRORCODE() ! Set Error Flag
- ELSE ! Otherwise on Updating a Record
- Error# = RIUpdate:INGREDIENT() ! Attempt Update
- END ! End If
- END ! End If
- IF Error# ! If Error Updating
- SETCURSOR() ! Reset to Normal Cursor
- Button# = StandardWarning(Warn:UpdateError) ! Ask If User Wants to Try Saving Again
- DISPLAY ! Refresh Screen
- CASE Button# ! Process User Response
- OF Button:Yes ! On YES Button
- CYCLE ! Retry Update Operation
- OF Button:No ! On NO Button
- BREAK ! Exit without Updating Record
- OF Button:Cancel ! On Cancel Button
- TC:INL:AbortUpdate = True ! Tell Inline to Cancel Update Request
- BREAK ! Go back to editing record
- END ! End Case
- END ! End If
- SETCURSOR() ! Reset to Normal Cursor
- LocalResponse = RequestCompleted ! Set Local Response to Completed
- BREAK ! Exit Update Loop
- END !End Loop
- !
- OF TCACTION:AbortUpdate !Abort Update Action
- IF TC:INL:ResizeWindow THEN CYCLE. !Always abort changes on resize
- IF SAVE:ING:RECORD <> ING:RECORD !If the Record was Changed
- Button# = StandardWarning(Warn:SaveOnCancel) ! Display Save on Cancel Message
- DISPLAY ! Refresh Screen
- CASE Button# ! Process User Response
- OF Button:Yes ! On YES Button
- TC:INL:AbortUpdate = False ! Cancel the Request to Abort
- TC:INL:SelectField = ListControl ! Select List to Exit & Save Changes
- OF Button:No ! On NO Button
- TC:INL:AbortUpdate = True ! Go Ahead and Abandon the Changes
- OF BUTTON:Cancel ! On Cancel Button
- TC:INL:AbortUpdate = False ! Cancel the Request and Continue
- END ! End Case
- END !End If
- IF UpdateAction = TCACTION:InsertRecord !If Adding a New Record
- IF TC:INL:AbortUpdate = True ! If Record Add was Aborted
- DELETE(INGREDIENT) ! Delete the New Record from the File
- END ! End If
- END !End If
- !
- OF TCACTION:ExitInLine !Exit InLine Action
- BREAK !
- END !End Case on Actions
- END !End Loop
- !
- GlobalResponse = LocalResponse !Set Global Response
- RETURN !Exit In-Line Update Procedure
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Delete Record Routine !
- ! !
- ! This routine Deletes the Record. !
- !--------------------------------------------------------------------------------------------------!
- DeleteRecord ROUTINE
-
- LocalResponse = RequestCancelled !Default to Request to Delete Cancelled
- !
- Confirm# = StandardWarning(Warn:StandardDelete) !Get Confirmation from User
- DISPLAY !Refresh Screen
- IF Confirm# <> Button:OK THEN EXIT. !If User Did Not Confirm Delete then Exit
- !
- LOOP !Attempt to Delete Until Done or Canceled
- SETCURSOR(Cursor:Wait) ! Show Hour-Glass Cursor
- IF RIDelete:INGREDIENT() ! If Error Deleting
- SETCURSOR() ! Reset to Normal Cursor
- CASE StandardWarning(Warn:DeleteError) ! Ask If User Wants to Try Deleting Again
- OF Button:Yes ! On YES Button
- CYCLE ! Retry Delete Operation
- OF Button:No ! On NO Button
- OROF Button:Cancel ! Or On Cancel Button
- BREAK ! Exit without Deleting Record
- END ! End Case
- END ! End If
- SETCURSOR() ! Reset to Normal Cursor
- LocalResponse = RequestCompleted ! Set Request Completed
- BREAK ! Exit Delete Loop
- END !End Loop
-
-
-
-
-